package com.xdf.bean;

import lombok.Data;

/**
 * @author xudengfeng
 * @date 2020/12/3 20:59
 */

@Data
public class ResponseVo {

    private Integer code;

    private Object data;

    private String message;

    public static ResponseVo ok(Object data) {
        ResponseVo responseVo = new ResponseVo();
        responseVo.setCode(0);
        responseVo.setData(data);
        responseVo.setMessage(null);
        return responseVo;
    }

    public static ResponseVo ok(Object data, String msg) {
        ResponseVo responseVo = new ResponseVo();
        responseVo.setCode(0);
        responseVo.setData(data);
        responseVo.setMessage(msg);
        return responseVo;
    }

    public static ResponseVo failed(String msg) {
        ResponseVo responseVo = new ResponseVo();
        responseVo.setCode(-1);
        responseVo.setData(null);
        responseVo.setMessage(msg);
        return responseVo;
    }

}
